package com.example.response;

import org.json.JSONException;
import org.json.JSONObject;

import com.example.network.Response;
import com.example.resource.ProjectDetails;

public class ProjectDetailsResponse extends Response
{
	public ProjectDetails projectDetails;
	
	@Override
	protected void jsonToObject()
	{
		projectDetails = new ProjectDetails();
		try
		{
			JSONObject data = reposonJson.getJSONObject("result");
			projectDetails.investableAmount = data.optString("investableAmount");
			projectDetails.token = data.optString("token");
			projectDetails.tradeId = data.optInt("tradeId");
			projectDetails.interestRate = data.optString("interestRate");
			projectDetails.leastInvestAmount = data.optString("leastInvestAmount");
			projectDetails.saturationCondition = data.optString("saturationCondition");
			projectDetails.timeLimitUnit = data.optString("timeLimitUnit");
			projectDetails.timeLimit = data.optString("timeLimit");
			projectDetails.loanedAmount = data.optString("loanedAmount");
			projectDetails.deadline = data.optString("deadline");
			projectDetails.effectiveDateTime = data.optLong("effectiveDateTime");
			projectDetails.loanNote = data.optString("loanNote");
			projectDetails.guaranteeName = data.optString("guaranteeName");
			projectDetails.userName = data.optString("userName");
			projectDetails.selfDefinedTitle = data.optString("selfDefinedTitle");
			projectDetails.investAvalibleTime = data.optString("investAvalibleTime");
			projectDetails.loanAmount = data.optString("loanAmount");
			projectDetails.saturation_condition_method = data.optString("saturation_condition_method");
			projectDetails.guaranteeLicenseUrl = data.optString("guaranteeLicenseUrl");
			projectDetails.guaranteeLicenseNo = data.optString("guaranteeLicenseNo");
			projectDetails.contractNo = data.optString("contractNo");
			projectDetails.loanPurpose = data.getString("loanPurpose");
			projectDetails.proStatus = data.optInt("proStatus");
			projectDetails.guaranteeStatement = data.optString("guaranteeStatement");
			projectDetails.guaranteeAudit = data.optString("guaranteeAudit");
		}
		catch (JSONException e)
		{
			e.printStackTrace();
		}
	}
}
